<!--
 * @Author: jiangyg email@jiangyg.com
 * @Date: 2022-11-12 07:35:16
 * @LastEditors: jiangyg email@jiangyg.com
 * @LastEditTime: 2022-11-12 11:07:25
 * @FilePath: /frontend/mall-frontend/src/views/modules/admin/main-aside.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <el-aside :width="asideWith" class="site-aside">
    <div class="site-menu" :style="{ 'background-color': backgroundColor }">
      <main-menu :collapse="collapse" :background-color="backgroundColor" />
    </div>
  </el-aside>
</template>

<script lang="ts" setup>
import { useStore } from "vuex";
import { ref, computed } from "vue";

import MainMenu from "@/views/modules/admin/main-menu.vue";

const store = useStore();

// 定义导航栏背景颜色
const backgroundColor = ref("#304156");

// 导航栏折叠状态
const collapse = computed(() => store.getters["collapse"]);

// 导航栏宽度
const asideWith = computed(() => (collapse.value ? "56px" : "210px"));
</script>

<style lang="scss">
.site-aside {
  overflow: hidden;

  .site-menu {
    height: 100%;
    color: #fff;
  }
}
</style>